from selenium import webdriver
import time
import requests

driver = webdriver.Firefox()
driver.get('https://mail.163.com/')
driver.maximize_window()

frame = driver.find_element_by_css_selector('iframe[id^="x-URS-iframe"]')
driver.switch_to.frame(frame)  # 切入表单
driver.find_element_by_name('email').send_keys('bbb')
driver.find_element_by_name('password').send_keys('xxx')
driver.find_element_by_id('dologin').click()
driver.switch_to.default_content()  # 切出表单

url = requests.get('https://mail.163.com/')
respon = url.status_code
if respon == 200:
    print('登陆成功')
else:
    pass

time.sleep(1)
driver.quit()
